package org.zfes.snowier.cloud.zbss.metting.router.service.pub;

import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.metting.biz.dto.MettingDto;
import org.zfes.snowier.cloud.zbss.metting.biz.model.Mettings;
import org.zfes.snowier.cloud.zbss.metting.biz.service.IMettingsService;
@Controller("org.zfes.snowier.cloud.zbss.metting.router.service.pub.MettingsController") 
@RequestMapping("/met/service/pub/mettings")
public class MettingsController extends BaseController {

	
	@Autowired
	private IMettingsService mettingsService;
	
	
//	   @RequestMapping(value="/loadMettingsDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
//	    public @ResponseBody  Object loadMettingsDataSet(@RequestParam Map<String,Object> params){
//	    	params.put("tenantId", SecurityUtil.getTenantId().orElseThrow(()->ZAlert.newSLE("当前用户未分配租户")));
//		    DataSet dataSet=  mettingsService.loadMettingsDataSet(params);
//		    return ajaxQuery("dataSet", dataSet);
//	    }
	 
    @RequestMapping(value="/loadMettingsDto", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadMettingsDto(Long id){
		Optional<MettingDto> ops = mettingsService.loadMettingsDtoById(id);
		return ajaxQuery("mettingsDto",ops);
    }
	
   
    
    @RequestMapping(value="/loadMettings", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadMettings(Long id){
		Optional<Mettings> ops = mettingsService.loadMettingsById(id);
		return ajaxQuery("mettings",ops);
    }
}